import {RouteRecordRaw} from "vue-router";
import HomeView from "../views/home/HomeView.vue";
import UserLayout from "../layouts/UserLayout.vue";
import UserForgotPasswordView from "../views/user/UserForgotPasswordView.vue";
import UserLoginView from "../views/user/UserLoginView.vue";
import QuestionLayout from "../layouts/QuestionLayout.vue";
import QuestionDetailView from "../views/question/questionDetail/QuestionDetailView.vue";
import AddQuestionView from "../views/question/addQuestion/AddQuestionView.vue";
import AddQuestionSetView from "../views/set/addSet/AddSetView.vue";
import InfoView from "../views/info/InfoView.vue";
import ProfileView from "../views/profile/ProfileView.vue";
import NotFoundView from "../views/NotFoundView.vue";
import UpdateQuestionView from "../views/question/addQuestion/UpdateQuestionView.vue";
import StudyPlanView from "../views/studyPlan/StudyPlanView.vue";
import StudyPlanDetailView from "../views/studyPlan/StudyPlanDetailView.vue";
import UpdateSetView from "../views/set/updateSet/UpdateSetView.vue";
import ManageView from "../views/manage/ManageView.vue";
import ProfileLayout from "../layouts/ProfileLayout.vue";
import ProfileEditView from "../views/profile/ProfileEditView.vue";
import ProfileSecureView from "../views/profile/ProfileSecureView.vue";
import ConfirmEmailView from "../views/profile/ConfirmEmailView.vue";

export const routes: Array<RouteRecordRaw> = [
    {
        path: "/",
        component: InfoView,
        meta: {layout: 'blank'}
    },
    {
        path: "/studyplan",
        component: StudyPlanView,
        meta: {layout: 'blank'}
    },
    {
        path: "/studyplan/:id",
        component: StudyPlanDetailView,
        meta: {layout: 'blank'}
    },
    {
        path: "/add/question",
        component: AddQuestionView,
        meta: {layout: 'basic'}
    },
    {
        path: "/update/question/:id",
        component: UpdateQuestionView,
        meta: {layout: 'basic'}
    },
    {
        path: "/update/set/:id",
        component: UpdateSetView,
        meta: {layout: 'basic'}
    },
    {
        path: "/manage/home",
        component: ManageView,
        meta: {layout: 'basic'}
    },
    {
        path: "/add/set",
        component: AddQuestionSetView,
        meta: {layout: 'basic'}
    },
    {
        path: "/problem",
        component: HomeView,
        meta: {layout: 'basic'}
    },
    {
        path: "/user",
        component: UserLayout,
        meta: {layout: 'blank'},
        children: [
            {
                path: "login",
                component: UserLoginView,
            },
            {
                path: "forgot",
                component: UserForgotPasswordView,
            },
            {
                path: "",
                redirect: "/404"
            }
        ],
    },
    {
        path: "/question",
        component: QuestionLayout,
        meta: {layout: 'blank'},
        children: [
            {
                path: "detail/:id",
                component: QuestionDetailView
            },
            {
                path: "",
                redirect: "/404"
            }
        ]
    },
    {
        path: "/profile",
        component: ProfileLayout,
        meta: {layout: 'blank'},
        children: [
            {
                path: "edit",
                component: ProfileEditView
            },
            {
                path: 'secure',
                component: ProfileSecureView
            },
            {
                path: 'confirm-email/:token',
                component: ConfirmEmailView
            },
            {
                path: ":account",
                component: ProfileView
            },
            {
                path: "",
                redirect: "/404"
            }
        ]
    },
    {
        path: "/404",
        component: NotFoundView,
        meta: {layout: 'blank'}
    },
    {
        path: "/:pathMatch(.*)*",
        redirect: "/404"
    }
];
